﻿using System;
using System.ComponentModel.DataAnnotations;
using Lari.Configuration;
using Lari.Services.Validation;

namespace Lari.Services.ViewModel
{
    public class EmployeeModel
    {
        #region Primitive Properties
        [Required(ErrorMessage= MessageCode.Generic.ReguiredFldMsg)]
        public int ID
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        public int Title
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(75, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string FirstName
        {
            get;
            set;
        }
        [StringLength(25,ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string Middlename
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(75, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string LastName
        {
            get;
            set;
        }
        
        [RequiredEitherOr("DOB", "Age", ErrorMessage = MessageCode.Generic.DOBorAgeIsRequired)]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/mm/yyyy}")]
        [DataType(DataType.Date)]
        public DateTime? DOB
        {
            get;
            set;
        }
        [RequiredEitherOr("DOB", "Age", ErrorMessage = MessageCode.Generic.DOBorAgeIsRequired)]
        [RegularExpression(ValidationRegexConst.WholeNumber, ErrorMessage = MessageCode.Generic.WrongNumberFormat)]
        public int? Age
        {
            get;
            set;
        }
        [Required]
        public bool IsDOBCulculated
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        [StringLength(2)]
        public string GenderCode
        {
            get;
            set;
        }
        public int? DesignationId
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        public int DepartmentId
        {
            get;
            set;
        }
        public int? Location
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        public int EmployeeType
        {
            get;
            set;
        }
       [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        [StringLength(2)]
        public string MaritalStatusCode
        {
            get;
            set;
        }
        public int? BloodGpId
        {
            get;
            set;
        }
        [StringLength(2)]
        public string ReligionCode
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        [StringLength(2)]
        public string NationalityCode
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(250,ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string HomeAddress
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(100,ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string HomeCity
        {
            get;
            set;
        }
        
        [StringLength(2)]
        [RequiredEitherOr("HomeStateCode", "HomeStateOther",ErrorMessage = MessageCode.Generic.StateOrOtherStateOnlyOne)]
        public string HomeStateCode
        {
            get;
            set;
        }
        [StringLength(100,ErrorMessage = MessageCode.Generic.LengthExceeded)]
        [RequiredEitherOr("HomeStateCode", "HomeStateOther", ErrorMessage= MessageCode.Generic.StateOrOtherStateOnlyOne)]
        public string HomeStateOther
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        [StringLength(2)]
        public string HomeCountryCode
        {
            get;
            set;
        }
        [StringLength(10,ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string HomePinCode
        {
            get;
            set;
        }
        [StringLength(20, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string HomePhone
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(250, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string WorkAddress
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.ReguiredFldMsg)]
        [StringLength(100, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string WorkCity
        {
            get;
            set;
        }
        [StringLength(2)]
        [RequiredEitherOr("WorkStateCode", "WorkStateOther", ErrorMessage = MessageCode.Generic.StateOrOtherStateOnlyOne)]
        public string WorkStateCode
        {
            get;
            set;
        }
        [StringLength(100, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        [RequiredEitherOr("WorkStateCode", "WorkStateOther", ErrorMessage = MessageCode.Generic.StateOrOtherStateOnlyOne)]
        public string WorkStateOther
        {
            get;
            set;
        }
        [Required(ErrorMessage = MessageCode.Generic.RequiredPleaseSelect)]
        [StringLength(2)]
        public string WorkCountryCode
        {
            get;
            set;
        }
        [StringLength(10, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string WorkPinCode
        {
            get;
            set;
        }
        [StringLength(20, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string WorkPhone
        {
            get;
            set;
        }
        [StringLength(20, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        public string Mobile
        {
            get;
            set;
        }
        [StringLength(50, ErrorMessage = MessageCode.Generic.LengthExceeded)]
        [RegularExpression(ValidationRegexConst.MatchEmailPattern, ErrorMessage = MessageCode.Generic.InvalidEmail)] 
        public string Email
        {
            get;
            set;
        }
        [Required]
        public bool IsConsultant
        {
            get;
            set;
        }
        [Required]
        public bool Active
        {
            get;
            set;
        }
        public byte[] Photograph
        {
            get;
            set;
        }

        public UserModel User { get; set; }

        #endregion
      
    }
}
